package com.bltec.emergency.service.recordService.impl;

import com.bltec.emergency.mapper.RecordTrainMapper;
import com.bltec.emergency.model.RecordTrain;
import com.bltec.emergency.service.recordService.RecordTrainService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RecordTrainServiceImpl implements RecordTrainService {
    @Resource
    RecordTrainMapper recordTrainMapper;

    @Override
    public boolean add(RecordTrain recordTrain) {
        return recordTrainMapper.insert(recordTrain);
    }

    @Override
    public boolean deleteTrainById(Long id) {
        return recordTrainMapper.setDisableById(id);
    }

    @Override
    public boolean updateTrainById(RecordTrain recordTrain) {
        return recordTrainMapper.updateTrainById(recordTrain);
    }

    @Override
    public Long getIdByTrainName(String TrainName) {
        return recordTrainMapper.getIdByTrainName(TrainName);
    }

    @Override
    public RecordTrain getTrainById(Long id) {
        return recordTrainMapper.getTrainById(id);
    }

    @Override
    public RecordTrain getTrainByTrainName(String TrainName) {
        return recordTrainMapper.getTrainByTrainName(TrainName);
    }

    @Override
    public List<RecordTrain> getAll() {
        return recordTrainMapper.selectAll();
    }
}
